
<!DOCTYPE html>
<html>

    <head lang="en">
        <meta charset="UTF-8">
        <title>注册</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <meta name="format-detection" content="telephone=no">
        <meta name="renderer" content="webkit">
        <meta http-equiv="Cache-Control" content="no-siteapp" />

        <link rel="stylesheet" href="/static/myhome/AmazeUI-2.4.2/assets/css/amazeui.min.css" />
        <link href="/static/myhome/css/dlstyle.css" rel="stylesheet" type="text/css">
        <script src="/static/myhome/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
        <script src="/static/myhome/AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>

    </head>

    <body>

        <div class="login-boxtitle">
            <a href="home/demo.html"><img alt="" src="/static/myhome/images/logobig.png" /></a>
        </div>

        <div class="res-banner">
            <div class="res-main">
                <div class="login-banner-bg"><span></span><img src="/static/myhome/images/big.jpg" /></div>
                <div class="login-box">

                        <div class="am-tabs" id="doc-my-tabs">
                            <ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
                                <li class="am-active"><a href="">手机号注册</a></li>
                            </ul>

                            
                                <div class="am-tab-panel">
                                    <form method="post">
                 <div class="user-phone">
                                    <label for="phone"><i class="am-icon-mobile-phone am-icon-md"></i></label>
                                    <input type="tel" name="phone" id="phone" placeholder="请输入手机号">
                 </div>                                                                         
                                        <div class="verification">
                                            <label for="code"><i class="am-icon-code-fork"></i></label>
                                            <input type="tel" name="code" style="width: 60%;" id="code" placeholder="请输入验证码">
                                            <button  type="button" class="btn" id="sendMobileCode">
                                                获取验证码
                                            </button>
                                        </div>
                 <div class="user-pass">
                                    <label for="password"><i class="am-icon-lock"></i></label>
                                    <input type="password" name="password" id="password" placeholder="设置密码">
                 </div>                                     
                 <div class="user-pass">
                                    <label for="passwordRepeat"><i class="am-icon-lock"></i></label>
                                    <input type="password" name="" id="passwordRepeat" placeholder="确认密码">
                 </div> 
                             
                                        <div class="am-cf">
                                            <input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl">
                                        </div>
                                
                                    <hr>
                                </div>
                                    {% csrf_token %}
                                    </form>

                                <script>
                                    var PHONE = false;
                                    var phone = null;
                                    // 定义发送手机验证码的函数
                                    $('#sendMobileCode').click(function(){
                                        // 手机号正确,则发送验证码,不正确,则提醒
                                        if(!PHONE){
                                            alert('手机号不正确')
                                            return;
                                        }

                                        // 发送ajax请求.给手机号发送验证码
                                        $.get('{% url 'myhome_sendmsg' %}',{'phone':phone},function(data){
                                            console.log(data)
                                        },'json')

                                        // 定时器,倒计时
                                        var num = 60
                                        var init = setInterval(function(){
                                            num --
                                            if(num <= 0){
                                                $('#sendMobileCode').text('重新发送').prop("disabled", false);
                                                clearInterval(init)
                                            }else{
                                                $('#sendMobileCode').text('重新发送('+num+')').prop("disabled", true);
                                            }

                                        },1000)



                                    })

                                    // 给手机号绑定丧失焦点事件
                                    $('#phone').blur(function(){
                                        // 获取输入的手机号,验证是否正确,验证是否存在
                                        phone = $(this).val()
                                        var reg = /^1[3|5|7|8|9|4][0-9]{9}$/
                                        if(!reg.test(phone)){
                                            // 手机号不正确
                                            alert('手机号格式不正确')
                                            PHONE = false
                                            return;
                                        }

                                        //发送ajax验证手机号是否存在
                                        $.get('{% url 'myhome_checkphone' %}',{'phone':phone},function(data){
                                            if(data.error){
                                                // 不能使用,已经存在
                                                alert('手机号已经注册')
                                                PHONE = false
                                            }else{
                                                PHONE = true
                                            }
                                        },'json')
                                    })

                                </script>

                            </div>
                        </div>

                </div>
            </div>
            
                    <div class="footer ">
                        <div class="footer-hd ">
                            <p>
                                <a href="# ">恒望科技</a>
                                <b>|</b>
                                <a href="# ">商城首页</a>
                                <b>|</b>
                                <a href="# ">支付宝</a>
                                <b>|</b>
                                <a href="# ">物流</a>
                            </p>
                        </div>
                        <div class="footer-bd ">
                            <p>
                                <a href="# ">关于恒望</a>
                                <a href="# ">合作伙伴</a>
                                <a href="# ">联系我们</a>
                                <a href="# ">网站地图</a>
                                <em>© 2015-2025 Hengwang.com 版权所有</em>
                            </p>
                        </div>
                    </div>
    </body>

</html>